#include "windowmfcc.h"
#include "ui_windowmfcc.h"

WindowMFCC::WindowMFCC(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::WindowMFCC)
{
    ui->setupUi(this);
}
WindowMFCC::WindowMFCC(std::vector<double> &ti,
                       std::vector<std::vector<double>>& mfccFp,
                       std::vector<std::vector<double>>&mfcc_dFp,
                       std::vector<std::vector<double>>&mfcc_ddFp,QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::WindowMFCC)
{
    ui->setupUi(this);
    ui->textBrowser->clear(); // clear 清空文本框
    QString tmpText = "";

    tmpText += "time | MFCC | MFCC_d | MFCC_dd \n";

    for (uint i = 0; i < ti.size(); ++ i) {

        tmpText += QString::number(ti[i]) + " | ";
        for (uint j = 0; j < mfccFp[i].size(); ++ j) {
            tmpText += QString::number(mfccFp[i][j]) + " ";
        }
        tmpText += "| ";
        for (uint j = 0; j < mfcc_dFp[i].size(); ++ j) {
            tmpText += QString::number(mfcc_dFp[i][j]) + " ";
        }
        tmpText += "| ";
        for (uint j = 0; j < mfcc_ddFp[i].size(); ++ j) {
            tmpText += QString::number(mfcc_ddFp[i][j]) + " ";
        }
        tmpText += "\n";
    }
    ui->textBrowser->append(tmpText);
}


WindowMFCC::~WindowMFCC()
{
    delete ui;
}
